﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace GzipManagerPro.UI.Dialogs
{
    public partial class ArchiveDialog : Form
    {
        public ArchiveDialog()
        {
            InitializeComponent();
        }

        private void EnablePassword_CheckedChanged(object sender, EventArgs e)
        {
            this.PasswordLabel.Enabled =
                this.Password.Enabled =
                this.ConfirmPasswordLabel.Enabled =
                this.ConfirmPassword.Enabled = this.EnablePassword.Checked;

            if (this.EnablePassword.Checked)
            {
                this.Password.Focus();
                this.Password.SelectAll();
            }
        }

        public string PasswordValue
        {
            get
            {
                return this.Password.Text;
            }
        }

        public string StoryBoardValue
        {
            get
            {
                return this.RicherTextBox.Rtf;
            }
        }

        private void OK_Click(object sender, EventArgs e)
        {
            if (this.EnablePassword.Checked)
            {
                if (this.Password.Text != this.ConfirmPassword.Text)
                {
                    this.TabControl.SelectedTab = this.ConfigurationPage;
                    this.Password.Focus();
                    this.Password.SelectAll();
                    "The passwords are not matched!".Error("Create Archive");

                    return;
                }
            }

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }

    }
}
